#include "..\msc10k\msc10k.h"
#include "..\dtc901\dtc901.h"
#include "..\dtc901\dtc901x64\dtc901x64.h"
#include <stdlib.h>
#include <stdio.h>

static BOOL IsWow64()
{
	typedef BOOL(WINAPI* LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
	HMODULE hModu = GetModuleHandleA("kernel32");
	if (hModu == 0) {
		return(FALSE);
	}

	LPFN_ISWOW64PROCESS fnIsWow64Process;
	BOOL bIsWow64 = FALSE;
	fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(hModu, "IsWow64Process");
	if (NULL != fnIsWow64Process)
	{
		fnIsWow64Process(GetCurrentProcess(), &bIsWow64);
	}
	return bIsWow64;
}

void CountCards(void)
{
	int n;
	if (IsWow64()) {
		n = Dtc64CountCards();
		printf("Found %d D9xx under pci-e x64\n", n);
	}
	else {
		n = DtcCountCards();
		printf("Found %d D9xx under pci-e\n", n);

		n = MscGetNumOfCards();
		printf("Found %d D9xx under pci\n", n);
	}
}

int dtest_main()
//int main()
{
	CountCards();
	return(0);
}
